﻿<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    %>
    <link rel="stylesheet" href="<%=path %>/css/common.css">
    <link rel="stylesheet" href="<%=path %>/css/main.css">
    <link rel="stylesheet" href="<%=path %>/css/layui.css">
    <link rel="stylesheet" href="<%=path %>/css/my.css">
    <script src="<%=path %>/js/jquery-1.12.4.js"></script>
    <title>Document</title>
</head>
<body>


<div class="container">

    <div id="table" class="mt10">
        <div class="box span10 oh">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table">
                <tr>
                    <th width="10%">序号</th>
                    <th width="10%">年份</th>
                    <th width="20%">专业</th>
                    <th width="10%">班级</th>
                    <th width="20%">学院</th>


                    <th>
                        操作
                    </th>
                </tr>

                <c:forEach var="item" items="${classesPage.data}">
                    <tr class="tr">
                        <td class="td_center">${item.id}</td>
                        <td class="td_center">${item.nianFen}</td>
                        <td class="td_center">${item.zhuanYe}</td>
                        <td class="td_center">${item.banJi}</td>
                        <td class="td_center">${item.xueYuan}</td>


                        <td class="td_center">
                            <a title="编辑" class="layui-btn layui-btn-sm layui-btn-normal"
                               href="<%=path %>/modifyGrade/${item.id}">
                                编辑
                            </a>
                            <a class="layui-btn layui-btn-sm layui-btn-warm" title="查看班级学生"
                               href="<%=path %>/studentListByClassId?id=${item.id}">
                                查看学生
                            </a>
                            <a title="删除" class="layui-btn layui-btn-sm layui-btn-danger"
                               href="javascript:void(0)"
                               onclick="deleteGrade('${item.id}')"
                            >
                                删除
                            </a>
                        </td>
                    </tr>

                </c:forEach>
            </table>
            <c:if test="${classesPage.total==0}">
                <h2 style="text-align: center;margin: 150px;">无数据</h2>
            </c:if>
            <div id="resultRecords">
                共 ${classesPage.total} 条记录,
                当前第 ${classesPage.currentPage} 页,
                共 ${classesPage.totalPage} 页，
                每页显示
                <select onchange="changePageSize(this)">
                    <c:forEach items="5,10,20,50" var="num">
                        <c:if test="${classesPage.pageSize==num}">
                            <option selected>${num}</option>
                        </c:if>
                        <<c:if test="${classesPage.pageSize!=num}">
                        <option>${num}</option>
                    </c:if>
                    </c:forEach>
                </select>
                条
            </div>
            <div class="page mt10">
                <div class="pagination">
                    <ul>
                        <li><a href="<%=path %>/gradeList/1/${pageSize}">首页</a></li>
                        <li class=""><a
                                href="<%=path %>/gradeList/${classesPage.currentPage==1?1:classesPage.currentPage-1}/${classesPage.pageSize}">上一页</a>
                        </li>
                        <li class="<"><a
                                href="<%=path %>/gradeList/${classesPage.currentPage>=classesPage.totalPage?classesPage.currentPage:classesPage.currentPage+1}/${classesPage.pageSize}">下一页</a>
                        </li>
                        <li><a href="<%=path %>/gradeList/${classesPage.totalPage}/${classesPage.pageSize}">末页</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="<%=path%>/js/layer.js"></script>
<script type="text/javascript">
    function deleteGrade(id) {
        layer.confirm('确定删除？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            $.post("<%=path%>/deleteGrade", {
                id: id
            }, function (resp) {
                layer.msg(resp.message, {icon: 1});
                setTimeout(function () {
                    location.reload();
                }, 3000);
            })
        }, function () {
        });
    }

    function changePageSize(that) {
        location.href = "<%=path%>/gradeList/${currentPage}/" + that.value;
    }
</script>

</html>

  